﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DocGia.VO;
using System.Data.SqlClient;
using System.Data;
namespace DAL
{
    public class DGDAL:ketnoi
    {

        public bool _DocGia_them(DocGia.VO.DGVO data)
        {
            try
            {
                using (SqlCommand dbCmd = new SqlCommand("docgia_them", GetConnection()))
                {
                    dbCmd.CommandType = CommandType.StoredProcedure;
                    dbCmd.Parameters.Add(new SqlParameter("@MaDG", data.MDG));
                    dbCmd.Parameters.Add(new SqlParameter("@TenDG", data.TDG));
                    dbCmd.Parameters.Add(new SqlParameter("@NgaySinh",data.NS));
                    dbCmd.Parameters.Add(new SqlParameter("@DiaChi", data.DC));
                    dbCmd.ExecuteNonQuery();
                }
            }
            catch
            {

            }

            return true;
        }
        public bool _docgia_xem(DocGia.VO.DGVO data)
        {
            using (SqlCommand dbCmd = new SqlCommand("docgia_xem", GetConnection()))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@MaDG", data.MDG));
                dbCmd.Parameters.Add(new SqlParameter("@TenDG", data.TDG));
                dbCmd.Parameters.Add(new SqlParameter("@NgaySinh", data.NS));
                dbCmd.Parameters.Add(new SqlParameter("@DiaChi", data.DC));
                dbCmd.ExecuteNonQuery();
            }

            return true;
        }
        public bool _DocGia_sua(DocGia.VO.DGVO data)
        {
            using (SqlCommand dbCmd = new SqlCommand("docgia_sua", GetConnection()))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@MaDG", data.MDG));
                dbCmd.Parameters.Add(new SqlParameter("@TenDG", data.TDG));
                dbCmd.Parameters.Add(new SqlParameter("@NgaySinh", data.NS));
                dbCmd.Parameters.Add(new SqlParameter("@DiaChi", data.DC));
                dbCmd.ExecuteNonQuery();
            }

            return true;
        }
        public bool _DocGia_xoa(string MADG)
        {
            try
            {

                using (SqlCommand dbCmd = new SqlCommand("docgia_xoa", GetConnection()))
                {
                    dbCmd.CommandType = CommandType.StoredProcedure;
                    dbCmd.Parameters.Add(new SqlParameter("@MaDG", MADG));

                    dbCmd.ExecuteNonQuery();
                }
            }
            catch
            {
                
            }

            return true;
        }
    }
}
